<template>
  <div>
    <book-info :info="info"></book-info>
    <button open-type='share' class="btn">转发给好友</button>
  </div>
</template>
<script>
import {get} from '@/util'
import BookInfo from '@/components/BookInfo'
export default {
  data () {
    return {
      bookId: '',
      info: {}
    }
  },
  components: {
    BookInfo
  },
  mounted () {
    this.bookId = this.$root.$mp.query.id
    this.getBookDetail()
  },
  methods: {
    async getBookDetail () {
      const info = await get('/weapp/bookDetail', {
        id: this.bookId
      })
      wx.setNavigationBarTitle({
        title: info.title
      })
      this.info = info
    }
  },
  onShow () {
    wx.setStorageSync('isViewd', true)
  }
}
</script>
<style lang="scss" scoped>

</style>
